using System; 
using System.Text; 
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration; 
using System.Xml; 
using System.Xml.Serialization;
using SubSonic; 
using SubSonic.Utilities;
namespace Medianamik.Core.DAL.SubSonicDAL{
    /// <summary>
    /// Strongly-typed collection for the DuplicateProperty class.
    /// </summary>
    [Serializable]
    public partial class DuplicatePropertyCollection : ReadOnlyList<DuplicateProperty, DuplicatePropertyCollection>
    {        
        public DuplicatePropertyCollection() {}
    }
    /// <summary>
    /// This is  Read-only wrapper class for the vw_medianamik_DuplicateProperty view.
    /// </summary>
    [Serializable]
    public partial class DuplicateProperty : ReadOnlyRecord<DuplicateProperty>, IReadOnlyRecord
    {
    
	    #region Default Settings
	    protected static void SetSQLProps() 
	    {
		    GetTableSchema();
	    }
	    #endregion
        #region Schema Accessor
	    public static TableSchema.Table Schema
        {
            get
            {
                if (BaseSchema == null)
                {
                    SetSQLProps();
                }
                return BaseSchema;
            }
        }
    	
        private static void GetTableSchema() 
        {
            if(!IsSchemaInitialized)
            {
                //Schema declaration
                TableSchema.Table schema = new TableSchema.Table("vw_medianamik_DuplicateProperty", TableType.View, DataService.GetInstance("MedianamikProvider"));
                schema.Columns = new TableSchema.TableColumnCollection();
                schema.SchemaName = @"dbo";
                //columns
                
                TableSchema.TableColumn colvarNodeId = new TableSchema.TableColumn(schema);
                colvarNodeId.ColumnName = "NodeId";
                colvarNodeId.DataType = DbType.Guid;
                colvarNodeId.MaxLength = 0;
                colvarNodeId.AutoIncrement = false;
                colvarNodeId.IsNullable = false;
                colvarNodeId.IsPrimaryKey = false;
                colvarNodeId.IsForeignKey = false;
                colvarNodeId.IsReadOnly = false;
                
                schema.Columns.Add(colvarNodeId);
                
                TableSchema.TableColumn colvarPropertyId = new TableSchema.TableColumn(schema);
                colvarPropertyId.ColumnName = "PropertyId";
                colvarPropertyId.DataType = DbType.Guid;
                colvarPropertyId.MaxLength = 0;
                colvarPropertyId.AutoIncrement = false;
                colvarPropertyId.IsNullable = false;
                colvarPropertyId.IsPrimaryKey = false;
                colvarPropertyId.IsForeignKey = false;
                colvarPropertyId.IsReadOnly = false;
                
                schema.Columns.Add(colvarPropertyId);
                
                TableSchema.TableColumn colvarValueX = new TableSchema.TableColumn(schema);
                colvarValueX.ColumnName = "Value";
                colvarValueX.DataType = DbType.String;
                colvarValueX.MaxLength = -1;
                colvarValueX.AutoIncrement = false;
                colvarValueX.IsNullable = true;
                colvarValueX.IsPrimaryKey = false;
                colvarValueX.IsForeignKey = false;
                colvarValueX.IsReadOnly = false;
                
                schema.Columns.Add(colvarValueX);
                
                TableSchema.TableColumn colvarRevision = new TableSchema.TableColumn(schema);
                colvarRevision.ColumnName = "Revision";
                colvarRevision.DataType = DbType.Int32;
                colvarRevision.MaxLength = 0;
                colvarRevision.AutoIncrement = false;
                colvarRevision.IsNullable = true;
                colvarRevision.IsPrimaryKey = false;
                colvarRevision.IsForeignKey = false;
                colvarRevision.IsReadOnly = false;
                
                schema.Columns.Add(colvarRevision);
                
                TableSchema.TableColumn colvarCultureName = new TableSchema.TableColumn(schema);
                colvarCultureName.ColumnName = "CultureName";
                colvarCultureName.DataType = DbType.String;
                colvarCultureName.MaxLength = 10;
                colvarCultureName.AutoIncrement = false;
                colvarCultureName.IsNullable = false;
                colvarCultureName.IsPrimaryKey = false;
                colvarCultureName.IsForeignKey = false;
                colvarCultureName.IsReadOnly = false;
                
                schema.Columns.Add(colvarCultureName);
                
                TableSchema.TableColumn colvarDuplicateTime = new TableSchema.TableColumn(schema);
                colvarDuplicateTime.ColumnName = "DuplicateTime";
                colvarDuplicateTime.DataType = DbType.Int32;
                colvarDuplicateTime.MaxLength = 0;
                colvarDuplicateTime.AutoIncrement = false;
                colvarDuplicateTime.IsNullable = true;
                colvarDuplicateTime.IsPrimaryKey = false;
                colvarDuplicateTime.IsForeignKey = false;
                colvarDuplicateTime.IsReadOnly = false;
                
                schema.Columns.Add(colvarDuplicateTime);
                
                
                BaseSchema = schema;
                //add this schema to the provider
                //so we can query it later
                DataService.Providers["MedianamikProvider"].AddSchema("vw_medianamik_DuplicateProperty",schema);
            }
        }
        #endregion
        
        #region Query Accessor
	    public static Query CreateQuery()
	    {
		    return new Query(Schema);
	    }
	    #endregion
	    
	    #region .ctors
	    public DuplicateProperty()
	    {
            SetSQLProps();
            SetDefaults();
            MarkNew();
        }
        public DuplicateProperty(bool useDatabaseDefaults)
	    {
		    SetSQLProps();
		    if(useDatabaseDefaults)
		    {
				ForceDefaults();
			}
			MarkNew();
	    }
	    
	    public DuplicateProperty(object keyID)
	    {
		    SetSQLProps();
		    LoadByKey(keyID);
	    }
    	 
	    public DuplicateProperty(string columnName, object columnValue)
        {
            SetSQLProps();
            LoadByParam(columnName,columnValue);
        }
        
	    #endregion
	    
	    #region Props
	    
          
        [XmlAttribute("NodeId")]
        [Bindable(true)]
        public Guid NodeId 
	    {
		    get
		    {
			    return GetColumnValue<Guid>("NodeId");
		    }
            set 
		    {
			    SetColumnValue("NodeId", value);
            }
        }
	      
        [XmlAttribute("PropertyId")]
        [Bindable(true)]
        public Guid PropertyId 
	    {
		    get
		    {
			    return GetColumnValue<Guid>("PropertyId");
		    }
            set 
		    {
			    SetColumnValue("PropertyId", value);
            }
        }
	      
        [XmlAttribute("ValueX")]
        [Bindable(true)]
        public string ValueX 
	    {
		    get
		    {
			    return GetColumnValue<string>("Value");
		    }
            set 
		    {
			    SetColumnValue("Value", value);
            }
        }
	      
        [XmlAttribute("Revision")]
        [Bindable(true)]
        public int? Revision 
	    {
		    get
		    {
			    return GetColumnValue<int?>("Revision");
		    }
            set 
		    {
			    SetColumnValue("Revision", value);
            }
        }
	      
        [XmlAttribute("CultureName")]
        [Bindable(true)]
        public string CultureName 
	    {
		    get
		    {
			    return GetColumnValue<string>("CultureName");
		    }
            set 
		    {
			    SetColumnValue("CultureName", value);
            }
        }
	      
        [XmlAttribute("DuplicateTime")]
        [Bindable(true)]
        public int? DuplicateTime 
	    {
		    get
		    {
			    return GetColumnValue<int?>("DuplicateTime");
		    }
            set 
		    {
			    SetColumnValue("DuplicateTime", value);
            }
        }
	    
	    #endregion
    
	    #region Columns Struct
	    public struct Columns
	    {
		    
		    
            public static string NodeId = @"NodeId";
            
            public static string PropertyId = @"PropertyId";
            
            public static string ValueX = @"Value";
            
            public static string Revision = @"Revision";
            
            public static string CultureName = @"CultureName";
            
            public static string DuplicateTime = @"DuplicateTime";
            
	    }
	    #endregion
	    
	    
	    #region IAbstractRecord Members
        public new CT GetColumnValue<CT>(string columnName) {
            return base.GetColumnValue<CT>(columnName);
        }
        public object GetColumnValue(string columnName) {
            return base.GetColumnValue<object>(columnName);
        }
        #endregion
	    
    }
}
